An electronic key system including a portable electronic key device that wirelessly transmits an electronic key ID and a vehicle that performs verification of the received electronic key ID is known. A so-called relay attack in which unauthorized communication is made by using a relay to make unauthorized ID verification (refer to Patent Document 1) is a problem in the field of electronic key systems.
As a countermeasure against this unauthorized communication by using the relay, for example, a technique of, by building an acceleration sensor into a portable electronic key device in advance and determining movement of the electronic key device by acceleration detected by the acceleration sensor, determining validity of the communication is known (refer to Patent Document 2, for example). In a portable electronic key device of Patent Document 2, acceleration data of the portable electronic key device detected by an acceleration sensor is transmitted to a vehicle in a communication process for ID verification. The vehicle determines validity of movement of the portable electronic key device on the basis of the received acceleration data, and for example, when the acceleration is greater than zero and equal to or less than a threshold value, permits unlocking of door(s) of a vehicle.